import 'package:json_annotation/json_annotation.dart';

import 'user_model.dart';

part 'pipe_comment_data.g.dart';

@JsonSerializable()
class PipeCommentData extends Object {
  @JsonKey(name: 'hasNext')
  bool hasNext;

  @JsonKey(name: 'pageNo')
  int pageNo;

  @JsonKey(name: 'list')
  List<PipeCommentModel> list;

  @JsonKey(name: 'replaceId')
  List<String>? replaceId;

  PipeCommentData(
    this.hasNext,
    this.pageNo,
    this.list,
    this.replaceId,
  );

  factory PipeCommentData.fromJson(Map<String, dynamic> srcJson) => _$PipeCommentDataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$PipeCommentDataToJson(this);
}

@JsonSerializable()
class PipeCommentModel extends Object {
  @JsonKey(name: 'id')
  String id;

  @JsonKey(name: 'pid')
  String pid;

  @JsonKey(name: 'likes')
  int likes;

  @JsonKey(name: 'content')
  String? content;

  @JsonKey(name: 'user')
  UserModel user;

  @JsonKey(name: 'imgUrl')
  String? imgUrl;

  @JsonKey(name: 'isTop')
  int isTop;

  @JsonKey(name: 'isAuthorLike')
  int? isAuthorLike;

  @JsonKey(name: 'createdTime')
  String createdTime;

  @JsonKey(name: 'userSelfLikes')
  int userSelfLikes;

  @JsonKey(name: 'province')
  String? province;

  @JsonKey(name: 'city')
  String? city;

  @JsonKey(name: 'visibleToOneself')
  int visibleToOneself;

  @JsonKey(name: 'total')
  int? total;

  @JsonKey(name: 'replyList')
  List<PipeCommentModel>? replyList;

  @JsonKey(name: 'beReplyUserId')
  String? beReplyUserId;

  @JsonKey(name: 'replyUser')
  UserModel? replyUser;

  PipeCommentModel(this.id, this.pid, this.likes, this.user, this.imgUrl, this.isTop, this.isAuthorLike, this.createdTime, this.userSelfLikes, this.province, this.city, this.visibleToOneself, this.total, this.replyList, this.beReplyUserId, this.replyUser);

  factory PipeCommentModel.fromJson(Map<String, dynamic> srcJson) => _$PipeCommentModelFromJson(srcJson);

  Map<String, dynamic> toJson() => _$PipeCommentModelToJson(this);
}
